local skel = fk.CreateSkill {
  name = "emo__yanguang",
  tags = {Skill.Compulsory, Skill.Switch},
}

Fk:loadTranslationTable{
  ["emo__yanguang"] = "湮光",
  [":emo__yanguang"] = "锁定技，转换技，每回合限一次，你使用单目标实体牌结算后，视为使用一张：阳：无视护甲的火【杀】；阴：伤害+1的雷【杀】。",
}

skel:addEffect(fk.CardUseFinished, {
  anim_type = "offensive",
  times = function (_, player)
    return 1 - player:usedSkillTimes(skel.name)
  end,
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player:usedSkillTimes(skel.name) == 0
  end,
  on_use = function (self, event, target, player, data)
    local yang = player:getSwitchSkillState(skel.name, true) == fk.SwitchYang
    local use = player.room:askToUseVirtualCard(player, {
      name = yang and "fire__slash" or "thunder__slash", cancelable = false, skill_name = skel.name, skip = true,
      extra_data = {bypass_distances = true, bypass_times = true}
    })
    if not use then return end
    if not yang then
      use.additionalDamage = (use.additionalDamage or 0) + 1
    end
    player.room:useCard(use)
  end,
})

skel:addEffect(fk.BeforeHpChanged, {
  can_refresh = function(self, event, target, player, data)
    return player == target and data.damageEvent and data.damageEvent.card and data.damageEvent.card.name == "fire__slash"
    and table.contains(data.damageEvent.card.skillNames, skel.name) and data.shield_lost
  end,
  on_refresh = function (self, event, target, player, data)
    data.num = data.num - data.shield_lost
    data.shield_lost = 0
  end,
})

return skel
